package scauCmiScaffolding.compiled;

import org.eclipse.jet.JET2Context;
import org.eclipse.jet.JET2Template;
import org.eclipse.jet.JET2Writer;
import org.eclipse.jet.taglib.RuntimeTagElement;
import org.eclipse.jet.taglib.TagInfo;

public class _jet_cmiPagination吴恒欣欣版本 implements JET2Template {
    private static final String _jetns_c = "org.eclipse.jet.controlTags"; //$NON-NLS-1$

    public _jet_cmiPagination吴恒欣欣版本() {
        super();
    }

    private static final String NL = System.getProperty("line.separator"); //$NON-NLS-1$
    
    private static final TagInfo _td_c_get_1_9 = new TagInfo("c:get", //$NON-NLS-1$
            1, 9,
            new String[] {
                "select", //$NON-NLS-1$
            },
            new String[] {
                "$packageName", //$NON-NLS-1$
            } );

    public void generate(final JET2Context context, final JET2Writer __out) {
        JET2Writer out = __out;
        out.write("package ");  //$NON-NLS-1$        
        RuntimeTagElement _jettag_c_get_1_9 = context.getTagFactory().createRuntimeTag(_jetns_c, "get", "c:get", _td_c_get_1_9); //$NON-NLS-1$ //$NON-NLS-2$
        _jettag_c_get_1_9.setRuntimeParent(null);
        _jettag_c_get_1_9.setTagInfo(_td_c_get_1_9);
        _jettag_c_get_1_9.doStart(context, out);
        _jettag_c_get_1_9.doEnd();
        out.write(".base;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.io.Serializable;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.ArrayList;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("import java.util.List;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("public class CmiPagination implements Serializable {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("\tpublic static final long serialVersionUID = 1L;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic static final int BEGIN_PAGE_SIZE = 10; // 起始的每页记录数目");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate static final int MAX_CURSOR_NUMBER = 10; // 页面游标最大显示的数目");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int paginationSize = BEGIN_PAGE_SIZE; // 每页记录条数");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int beginPage = 1; // 起始页");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int currentPagination = beginPage; // 当前页");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int totalPaginations; // 总页数目");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int totalRecords; // 所有记录数目");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int searchBeginCursor; // 搜索起始的游标");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int searchEndCursor; // 搜索终止的游标");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int hiddenCurrentPagination = currentPagination; // 隐藏域用于jsp的页面传参，在绑定器中使用");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int hiddenTotalPaginations = totalPaginations; // 隐藏域用于jsp的页面传参，在绑定器中使用");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate String inputCurrentPagination = \"\"; // 选择页码按钮的控件变量");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate int queryBoxNumber = 1; // 组合条件查询的条件控件框数量");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t// 组合条件查询中选中的条件列表");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate List<String> selectedCompositeConditions = new ArrayList<String>(); ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t// 组合条件查询中用户输入的条件集合");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tprivate List<String> inputCompositeConditions = new ArrayList<String>(); ");  //$NON-NLS-1$        
        out.write(NL);         
        out.write(NL);         
        out.write("\tpublic CmiPagination() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic CmiPagination(int totalElements) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.reset(totalElements);");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t// 分页类的重新设置页面属性，每次查询，page对象的一些属性都需要重置。");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void reset(int totalElements) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.totalRecords = totalElements;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tif (this.totalRecords == 0) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tthis.totalPaginations = 1;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t} else if (this.totalRecords % this.paginationSize == 0) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tthis.totalPaginations = this.totalRecords / this.paginationSize;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t} else {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tthis.totalPaginations = this.totalRecords / this.paginationSize + 1;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.inputCurrentPagination = \"\";");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tif(this.totalPaginations <=  this.MAX_CURSOR_NUMBER + 1) {   //左边的区间和右边的区间重叠");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tthis.searchBeginCursor = 1;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tthis.searchEndCursor = this.totalPaginations;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t}else {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\tif(this.totalPaginations - this.currentPagination  < this.MAX_CURSOR_NUMBER/2) {    //在右边的区间");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tthis.searchBeginCursor  = this.totalPaginations - this.MAX_CURSOR_NUMBER;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tthis.searchEndCursor = this.totalPaginations;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t}else if (this.currentPagination - 1 < this.MAX_CURSOR_NUMBER/2) {  //在左边的区间");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tthis.searchBeginCursor = 1;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tthis.searchEndCursor =  this.searchBeginCursor + this.MAX_CURSOR_NUMBER;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t}else {//在中间的区间");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tthis.searchBeginCursor =  this.currentPagination - this.MAX_CURSOR_NUMBER/2;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t\tthis.searchEndCursor = this.currentPagination + this.MAX_CURSOR_NUMBER/2;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getBeginPage() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn beginPage;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setBeginPage(int beginPage) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.beginPage = beginPage;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getCurrentPage() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn currentPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setCurrentPage(int currentPagination) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.currentPagination = currentPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getTotalPage() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn totalPaginations;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setTotalPage(int totalPaginations) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.totalPaginations = totalPaginations;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getTotalElements() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn totalRecords;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setTotalElements(int totalElements) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.totalRecords = totalElements;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getSearchBeginCursor() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn searchBeginCursor;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setSearchBeginCursor(int searchBeginCursor) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.searchBeginCursor = searchBeginCursor;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getSearchEndCursor() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn searchEndCursor;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setSearchEndCursor(int searchEndCursor) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.searchEndCursor = searchEndCursor;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getPageSize() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn paginationSize;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setPageSize(int paginationSize) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.paginationSize = paginationSize;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getHiddenCurrentPage() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn hiddenCurrentPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setHiddenCurrentPage(int hiddenCurrentPagination) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.hiddenCurrentPagination = hiddenCurrentPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getHiddenTotalPage() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn hiddenTotalPaginations;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setHiddenTotalPage(int hiddenTotalPaginations) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.hiddenTotalPaginations = hiddenTotalPaginations;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getTotalRecords() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn totalRecords;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setTotalRecords(int totalRecords) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.totalRecords = totalRecords;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic String getInputCurrentPage() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn inputCurrentPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setInputCurrentPage(String inputCurrentPagination) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.inputCurrentPagination = inputCurrentPagination;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic List<String> getCombinedSelectConditions() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn selectedCompositeConditions;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setCombinedSelectConditions(List<String> combinedSelectConditions) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.selectedCompositeConditions = combinedSelectConditions;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic List<String> getCombinedConditions() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn inputCompositeConditions;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setCombinedConditions(List<String> combinedConditions) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.inputCompositeConditions = combinedConditions;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic int getQueryBoxNumber() {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\treturn queryBoxNumber;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\tpublic void setQueryBoxNumber(int queryBoxNumber) {");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t\tthis.queryBoxNumber = queryBoxNumber;");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("\t}");  //$NON-NLS-1$        
        out.write(NL);         
        out.write("}");  //$NON-NLS-1$        
        out.write(NL);         
    }
}
